<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Order Confirmation</title>
<style type="text/css">
/* <![CDATA[ */
table, td
{
    border-color: #666;
    border-style: solid;
}
table, th
{
    border-color: #666;
    border-style: solid;
}

table
{
    border-width: 0 0 1px 1px;
    border-spacing: 0;
    border-collapse: collapse;
}
 
td
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}
th
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}
/* ]]> */


</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

<script language="javascript">
function enab(){
	document.getElementById('btn_confirm').disabled = false;
	}
</script>
</head>
<body  style="font-family:Arial, Helvetica, sans-serif">
<h1>Please verify the Qty of following repair parts:</h1>
<h4>
<ul>
  <li>Scan Or Type in Parts Barcode</li>
  <li>Currently There is no auto saving function, please do not close this page before complete</li>
</ul>
</h4>
<?php 
if($this->errorMessage != ""){
?> 
<div style="border:#900 solid 2px; padding:15px; font-weight:bold;" > Stop! You still have issue with your shop stock, Please DO NOT PROCEED</div>
<?php }?>
<table width="500" border="0" cellspacing="1" cellpadding="0">

  <tr>
    <th bgcolor="#00FF00" scope="col">Qty Correct</th>
    <th bgcolor="#FF8080" scope="col"> No Stock</th>
    <th bgcolor="#FFFF00" scope="col">Incorrect</th>

  </tr>
</table>
<br />
Scan Or Type In Parts Barcode <br />
<form id="form1" name="form1" method="post" action="">
  <br />
  <input type="text" name="part_code" id="part_code" style="font-size:16px; width:300px;" />
  QTY:<input type="text" name="part_qty" id="part_qty" style="font-size:16px; width:50px;" />
  <input type="submit" name="btn_submit" id="btn_submit" value="Submit" />
<br />
	<input type="hidden" name="str_part" value="<?php echo $this->strPart?>" />
    <input type="hidden" name="hidden_part" value="<?php echo $this->hiddenpart?>" />
  <br />
  <input type="submit" name="btn_cancel" id="btn_cancel" value="Cancel Last Scan" />
<br />

<script language="javascript">
    document.getElementById('part_code').focus(); 
    </script> 
<br />
<?php
if(empty($this->oList)){	
?>
<div style="border:#900 solid 2px; padding:15px; font-weight:bold;" > Stop! The order hasn't been generate, please go back to last page and tick the "re-generate order" check box</div>
<?php
}
?>
<table width="1050" border="0" cellspacing="1" cellpadding="0">

    <tr>
    <th >No.</th>
    <th >Code</th>
    <th style="width:300px;" >Description</th>
    <th style="width:100px;" >System</th>
    <th style="width:200px;" >Actual</th>
    <th style="width:100px;" >Difference</th>
    <th style="width:100px;" >SubTotal</th>
    </tr>
<?php 
	$rProduct = new Model_DbTable_Pr_Prproducts();
	$arrParts = $this->arrParts;
	$i = 1;
if(!empty($this->oList)){	
foreach($this->oList as $key => $v){
//2014-08-05 for only show screen parts		
$product = $rProduct->getProduct($v['id_product']);
if($product['is_lcd']== 1){//
	$actQty = (isset($arrParts[$v['code_product']]))?$arrParts[$v['code_product']]:'0';
	$diff =  $actQty - $v['qty_onhand'];
	?> 
	<?php if($diff != 0){?>
  <tr 
 <?php
 
 	
	 
	
	if($diff == 0){
			echo 'style="background-color:#00FF00;"';		
	}
	if($diff!=0 && $actQty !=0){
		
		echo 'style="background-color:#FFFF00;"';	
	}
	if($diff!=0 && $actQty ==0){
		
		echo 'style="background-color:#FF8080;"';
		}	
 ?> 
 >	
 	<td><?php echo $i++;?></td>
    <td><?php echo $v['code_product']?></td>
    <td><span style="font-size:12px;"><?php echo $rProduct->getProductDes($v['code_product'])?></span></td>
    <td><?php echo $v['qty_onhand']?></td>
    <td align="center">
    <?php $actQty = 0;
	if(isset($arrParts[$v['code_product']])){
		$actQty = $arrParts[$v['code_product']];
		}
	$arrWrongpass = $this->arrWrongpass;	
	if(!empty($arrWrongpass)){
		$actQty = $arrWrongpass[$v['id_order']];
		}
	 ?>
    <input id= "qty_onhand_cf_<?php echo $v['id_order']?>" name="qty_onhand_cf[<?php echo $v['id_order']?>]" type="text" value="<?php echo $actQty ?>" style="width:30px;" />
    <input type="button" name="btn_rt_<?php echo $v['id_order']?>" id="btn_rt_<?php echo $v['id_order']?>" value="&lt;= 0" />
    <input type="button" name="btn_min_<?php echo $v['id_order']?>" id="btn_min_<?php echo $v['id_order']?>" value="- 1" /></td>
    <td><?php echo $actQty - $v['qty_onhand'];?></td>
    <td>&nbsp;</td>
  </tr>
 <?php }
	  }
	 }
	} ?> 
<?php 
if(!empty($this->oList)){	
foreach($this->oList as $key => $v){
//2014-08-05 for only show screen parts		
$product = $rProduct->getProduct($v['id_product']);
if($product['is_lcd']== 1){//
	$actQty = (isset($arrParts[$v['code_product']]))?$arrParts[$v['code_product']]:'0';
	$diff =  $actQty - $v['qty_onhand'];
	?> 
	<?php if($diff == 0){?>
  <tr 
 <?php
 
 	
	 
	
	if($diff == 0){
			echo 'style="background-color:#00FF00;"';		
	}
	if($diff!=0 && $actQty !=0){
		
		echo 'style="background-color:#FFFF00;"';	
	}
	if($diff!=0 && $actQty ==0){
		
		echo 'style="background-color:#FF8080;"';
		}	
 ?> 
 >	
 	<td><?php echo $i++;?></td>
    <td><?php echo $v['code_product']?></td>
    <td><span style="font-size:12px;"><?php echo $rProduct->getProductDes($v['code_product'])?></span></td>
    <td><?php echo $v['qty_onhand']?></td>
    <td align="center">
    <?php $actQty = 0;
	if(isset($arrParts[$v['code_product']])){
		$actQty = $arrParts[$v['code_product']];
		}
	$arrWrongpass = $this->arrWrongpass;	
	if(!empty($arrWrongpass)){
		$actQty = $arrWrongpass[$v['id_order']];
		}
	 ?>
    <input id= "qty_onhand_cf_<?php echo $v['id_order']?>" name="qty_onhand_cf[<?php echo $v['id_order']?>]" type="text" value="<?php echo $actQty ?>" style="width:30px;" />
    <input type="button" name="btn_rt_<?php echo $v['id_order']?>" id="btn_rt_<?php echo $v['id_order']?>" value="&lt;= 0" />
    <input type="button" name="btn_min_<?php echo $v['id_order']?>" id="btn_min_<?php echo $v['id_order']?>" value="- 1" /></td>
    <td><?php echo $actQty - $v['qty_onhand'];?></td>
    <td>&nbsp;</td>
  </tr>
 <?php }
	  }
	 }
	} ?>	
 
 
 


<tr>
<td style="padding:20px; text-align:center;" colspan="6">
  Your Comment To Your Manager /Warehouse Regarding the Stock Take<br />
  <br />
  <textarea name="comment" id="comment" cols="90" rows="5"></textarea></td>
</tr>
<tr>
  <td style="padding:20px; text-align:center;" colspan="6"><input type="checkbox" name="scan_finished" id="scan_finished" onchange="enab()" />
    <label for="scan_finished"></label>
    I have finished scanning all  parts in the List
    <input name="order_no" type="hidden" id="order_no" value="<?php echo $this->orderNo;?>" />
    <br />
    <br />
    Your Attendance Password :
    <label for="pwd"></label>
    <input type="password" name="pwd" id="pwd" />
    <br />
    <br />  
<?php 
if($this->errorMessage == ""){
?>    
    <input type="submit" name="btn_confirm_stocktake" id="btn_confirm_stocktake" value="Confirm Stock Take  Qty &amp; Proceed To Order"    />
<?php }
else{
	echo "You have following issue with your shop stock, please do not proceed the count<br />";
	echo $this->errorMessage;
	}
?>    
  
  
  
    <br />
    <br />
    * After the button Clicked, You Acknowledge you take fully responsibility of the stock take result, If the<br />
    Qty you count is inaccurate, your manager will have to re-do the stock take, so please make sure<br />
    you count all what you have.</td>
</tr>

</table>
</form>
<script language="javascript">
$(document).ready(function() {
	$('input[id^="btn_rt_"]').click(function(){
		var  line = $(this).attr("id").substr(7);
		var  strline = '#qty_onhand_cf_' + line;
		$(strline).val(0);
		//if(ronly =="readonly"){
		//alert("untick the confirm check box , then you can edit this line");
		//}
		});	

	$('input[id^="btn_min_"]').click(function(){
		var  line = $(this).attr("id").substr(7);
		var  strline = '#qty_onhand_cf' + line;
		var  qty  = parseInt($(strline).attr("value"));
		var qty2 = parseInt(qty - 1);
		$(strline).val(qty2);
		//if(ronly =="readonly"){
		//alert("untick the confirm check box , then you can edit this line");
		//}
		});
	
	});

$(function(){
	$("#part_code").keydown(function(e){
	    if(e.keyCode == 13){
	    	e.preventDefault();
	    	$('#part_qty').focus();
	    	$('#part_qty').select();
			
	    }
	  });
	
});	

</script>
</body>

</html>
